package com.yystar.security.support.util;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

/**
 * Used to record exception in file.
 * Log file in tomcat/logs
 * @author lixiaodong
 *
 */
public class AppExceptionUtil {
	private static Log exceptionLog = LogFactory.getLog("ExceptionLog");

	/**
	 * Record and print exception
	 * @param Exception
	 */
	public static void recordException(Exception e) {
		e.printStackTrace();
		exceptionLog.error(e.getMessage(), e);
	}
	
	/**
	 * Record and print exception
	 * @param Exception
	 * @param exMessage
	 */
	public static void recordException(Exception e, String exMessage) {
		e.printStackTrace();
		exceptionLog.error(exMessage, e);
	}
	
	/**
	 * Record exception message
	 * @param errorMessage
	 */
	public static void recordErrorMessage(String exMessage) {
		exceptionLog.error(exMessage);
	}

}
